package com.he.statemodel.state.concretestate;

import com.he.statemodel.context.WorkContext;
import com.he.statemodel.state.WorkState;

public class OvertimeState implements WorkState {
    @Override
    public void handle(WorkContext workContext) {
        if (workContext.getWorkHour() < 20) {
            if (workContext.isFinished()) {
                System.out.println("工作完成，加班结束！");
            } else {
                System.out.println("工作还没有完成，继续加班中！");
            }
        } else {
            workContext.setWorkState(new RestState());
            workContext.workhandle();
        }
    }
}
